// 作图产品结果缓存

export default {
    setResult(mpid, resultUrl) {
        wx.setStorage({
            key: this._cacheKey(mpid),
            data: {
                url: resultUrl,
                time: parseInt(Date.now())
            }
        });
    },
    getResult(mpid) {
        return wx.getStorageSync(this._cacheKey(mpid));
    },
    clearResult(mpid) {
        wx.clearStorage({
            key: this._cacheKey(mpid)
        });
    },
    _cacheKey(mpid) {
        return `[PRODUCT_RESULT]-${mpid}`;
    }
}